package com.atguigu.gulimall.product.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class ThreadConfig {
    @Bean
    public ThreadPoolExecutor executor(ThreadConfigProperties threadPool){
        return new ThreadPoolExecutor(threadPool.getCorePoolSize(),threadPool.getMixMumPoolSize(),threadPool.getKeepAliveTime(), TimeUnit.SECONDS,new LinkedBlockingDeque<>(1000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
    }
}
